﻿<div class="top-row pl-4 navbar navbar-dark">
    <a class="navbar-brand" href="">Blazor ServerSide</a>
    <button class="navbar-toggler" @onclick="ToggleNavMenu">
        <span class="navbar-toggler-icon"></span>
    </button>
</div>

<div class="@NavMenuCssClass" @onclick="ToggleNavMenu">
    <ul class="nav flex-column">
        <li class="nav-item px-3">
            <NavLink class="nav-link" href="" Match="NavLinkMatch.All">
                <span class="oi oi-home" aria-hidden="true"></span> Home
            </NavLink>
        </li>
        <li class="nav-item px-3">
            <NavLink class="nav-link" href="settings">
                <span class="oi oi-wrench" aria-hidden="true"></span> Settings
            </NavLink>
        </li>
        <li class="nav-item px-3">
            <NavLink class="nav-link" href="files">
                <span class="oi oi-document" aria-hidden="true"></span> Files
            </NavLink>
        </li>
        <li class="nav-item px-3">
            <NavLink class="nav-link" href="products">
                <span class="oi oi-list-rich" aria-hidden="true"></span> Products
            </NavLink>
        </li>
        <li class="nav-item px-3">
            <NavLink class="nav-link" href="users">
                <span class="oi oi-people" aria-hidden="true"></span> Users
            </NavLink>
        </li>
        <li class="nav-item px-3">
            <NavLink class="nav-link" href="auditlogs">
                <span class="oi oi-dashboard" aria-hidden="true"></span> Audit Logs
            </NavLink>
        </li>
        <AuthorizeView>
            <Authorized>
                <li class="nav-item px-3">
                    <NavLink class="nav-link" href="logout">
                        <span class="oi oi-account-logout" aria-hidden="true"></span> Logout
                    </NavLink>
                </li>
            </Authorized>
            <NotAuthorized>
                <li class="nav-item px-3">
                    <NavLink class="nav-link" href="login">
                        <span class="oi oi-account-login" aria-hidden="true"></span> Login
                    </NavLink>
                </li>
            </NotAuthorized>
        </AuthorizeView>
    </ul>
</div>

@code {
    private bool collapseNavMenu = true;

    private string NavMenuCssClass => collapseNavMenu ? "collapse" : null;

    private void ToggleNavMenu()
    {
        collapseNavMenu = !collapseNavMenu;
    }
}
